<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>换衣服</title>
    <link rel="stylesheet" href="index.css">
</head>

<body>
    <div class="bg-box">
        <div class="bg"></div>
        <img src="bg.jpeg" alt="">
    </div>
    <script>
        let bgBox = document.querySelector(".bg-box");
        let bg = document.querySelector(".bg");

        function setColor(){
            return Math.floor(Math.random() * 255)
        }
        bgBox.onclick = function(){
            bg.style.backgroundColor = `rgb(${setColor()},${setColor()},${setColor()})`
        }

    </script>
</body>

</html>